/*=============================================================================

  APPLICATION MANAGER MODULE

  FILE: UImgr.cpp
  
  DESCRIPTION

    Manager Module Definition

  EXTERNALIZED FUNCTIONS

    
  Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

                             EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who     what, where, why
  ---------  -------  -------------------------------------------------------
   06/28/03   nso4th   Version 0.1

=============================================================================*/

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include <UImgr_MOD.h>
#include <HAIO.h>

/*=============================================================================
  STRUCTURE DEFINITION
=============================================================================*/

/*=============================================================================
  DEV INIT TABLE DEFINITION
=============================================================================*/

/*=============================================================================
  EXTERNALIZED FUNCTION DEFINITION
=============================================================================*/
boolean io_event_proc(dword event, dword wp, dword lp)
{
	dword			evt, evtID;
	HIO				*io = (HIO*)ObjList_Get(HIO_DEV);
	HIOvw			*vw = (HIOvw*)ObjList_Get(VIEW_IODEV);
	
	evt = HDEV_GETEVENT(event);
	evtID = HDEV_GETDEV_ID(event);

	switch(evt)
	{
	case INIT_DONE_E:
	{
		iodev_cfg_s		*cfg;

		LOGINFO("[DIO] Initialization completed");
		
		if((io == NULL) || (vw == NULL))
			return	FALSE;

		cfg = io->CFG_Get();
		if(cfg == NULL)
			return	FALSE;
		
		vw->IO_Set(cfg->tbl);
		break;
	}
	case CLOSE_DONE_E: LOGINFO("[DIO] Termination completed"); ; break;
	case ERR_INIT_E: LOGERR("[DIO] Initialization failure"); break;
	case ERR_CLOSE_E: LOGERR("[DIO] Termination failure"); break;	
	}
	return	FALSE;
}

boolean aio_event_proc(dword event, dword wp, dword lp)
{
	dword			evt, evtID;
	HAIO			*aio = (HAIO*)ObjList_Get(HAIO_DEV);
	//HIOvw			*vw = (HIOvw*)ObjList_Get(VIEW_AIODEV);
	
	evt = HDEV_GETEVENT(event);
	evtID = HDEV_GETDEV_ID(event);

	switch(evt)
	{
	case INIT_DONE_E:
	{
		//aiodev_cfg_s		*cfg;

		LOGINFO("[AIO] Initialization completed");

		if(aio == NULL)
			return	FALSE;
		
		/*		----------------------2013. 12. 31. jyko
		if((aio == NULL) || (vw == NULL))
			return	FALSE;

		cfg = aio->CFG_Get();
		if(cfg == NULL)
			return	FALSE;
		
		vw->IO_Set((iodev_setup_s*)cfg->tbl);
		*/
		break;
	}
	case CLOSE_DONE_E: LOGINFO("[AIO] Termination completed"); ; break;
	case ERR_INIT_E: LOGERR("[AIO] Initialization failure"); break;
	case ERR_CLOSE_E: LOGERR("[AIO] Termination failure"); break;	
	}
	return	FALSE;
}

boolean mot_event_proc(dword event, dword wp, dword lp)
{
	dword		evt, evt_id;

	evt = HDEV_GETEVENT(event);
	evt_id = HDEV_GETDEV_ID(event);
	
	switch(evt)
	{
	case INIT_DONE_E: LOGINFO("[MOT] Initialization completed"); break;
	case CLOSE_DONE_E: LOGINFO("[MOT] Termination completed"); ; break;
	case ERR_INIT_E: LOGERR("[MOT] Initialization failure"); break;
	case ERR_CLOSE_E: LOGERR("[MOT] Termination failure"); break;	
	}

	return	FALSE;
}

boolean fg_event_proc(dword event, dword wp, dword lp)
{
	dword		evt, evt_id;

	evt = HDEV_GETEVENT(event);
	evt_id = HDEV_GETDEV_ID(event);
	
	switch(evt)
	{
	case INIT_DONE_E: LOGINFO("[F.G] Initialization completed"); break;
	case CLOSE_DONE_E: LOGINFO("[F.G] Termination completed"); ; break;
	case ERR_INIT_E: LOGERR("[F.G] Initialization failure"); break;
	case ERR_CLOSE_E: LOGERR("[F.G] Termination failure"); break;	
	}

	return	FALSE;
}

boolean cam_event_proc(dword event, dword wp, dword lp)
{
	dword		evt, evt_id;

	evt = HDEV_GETEVENT(event);
	evt_id = HDEV_GETDEV_ID(event);
	
	switch(evt)
	{
	case INIT_DONE_E: LOGINFO("[CAM] Initialization completed"); break;
	case CLOSE_DONE_E: LOGINFO("[CAM] Termination completed"); ; break;
	case ERR_INIT_E: LOGERR("[CAM] Initialization failure"); break;
	case ERR_CLOSE_E: LOGERR("[CAM] Termination failure"); break;	
	}

	return	FALSE;
}


/*--- END OF UImgr_dev.CPP ---*/
